package com.chenyun.common.vo;

import com.chenyun.common.enums.BusMessageType;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;

/**
 * 用于发送业务消息给socket服务的接受类
 * @author: Lonni
 * @date: 2023/4/20 0020 19:10
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class BusMessageVO implements Serializable {
    
    @NotNull(message = "消息类型不能为空!")
    private BusMessageType msgType;


    private String fromId;
    private List<String> toIds;
    @NotNull(message = "消息体不能为空!")
    private Object body;

    @JsonValue
    public BusMessageType getMsgType() {
        return msgType;
    }


}



